#!/bin/bash

NAME=rocketmq-dashboard
SERVER=120.79.4.43:9876
PORT=9870
TAG=latest

while getopts "n:s:p:t:" opt; do
  case $opt in
    n)
        NAME=$OPTARG
        ;;
    s)
        SERVER=$OPTARG
        ;;
    p)
        PORT=$OPTARG
        ;;
    t)
        TAG=$OPTARG
        ;;
    \?)
        echo "invalid arg"
        exit 1
        ;;
  esac
done

docker run \
-d \
--rm \
--name ${NAME} \
-e "JAVA_OPTS=-Drocketmq.namesrv.addr=${SERVER}" \
-p ${PORT}:8080 \
apacherocketmq/rocketmq-dashboard:${TAG}